// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import 'font-awesome/css/font-awesome.css'
import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './routes'
import App from './App'
import components from 'src/components'
import filters from './filters'
import directives from './directives'

// 注册全局过滤器
// ------------------------------
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

// 注册自定义指令
// ------------------------------
Object.keys(directives).forEach(key => {
  Vue.directive(key, directives[key])
})

Vue.use(VueRouter)

const router = new VueRouter({
  routes: routes
})

// 注册全局组件
// ------------------------------
Vue.use(components)

/* eslint-disable no-new */
new Vue({
  el: '#app',
  template: '<App/>',
  components: { App },
  router
})
